package com.alibaba.dingtalk.openapi.newmessage.delivery;/*/*/

import com.alibaba.dingtalk.openapi.exception.ApiRuleException;
import com.alibaba.dingtalk.openapi.newmessage.utils.DeliveryCheckUtils;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 查询工作通知消息的发送进度
 * @author 魏荣杰
 * @date 2019/3/21 20:26
 * @since v1.0
 * @version v1.0
 */
@Setter
@Getter
@ToString
public class CorpConversationProgressMsgDelivery extends AbstractDelivery {
    private static final long serialVersionUID = -4720340839852889724L;

    /**
     * 发送消息时使用的微应用的id
     */
    private Long agentId;
    /**
     * 发送消息时钉钉返回的任务id
     */
    private Long taskId;

    @Override
    public JSONObject toJsonObject() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("agent_id", this.agentId);
        jsonObject.put("task_id", this.taskId);
        return jsonObject;
    }

    @Override
    public void check() throws ApiRuleException {
        DeliveryCheckUtils.checkNotEmpty(this.agentId, "agentId");
        DeliveryCheckUtils.checkNotEmpty(this.taskId, "taskId");
    }
}
